unit untCadProprietario;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, untCadPadrao, cxStyles, cxCustomData, cxGraphics, cxFilter,
  cxData, cxDataStorage, cxEdit, DB, cxDBData, IBCustomDataSet, cxIntlBase,
  cxintl, cxPropertiesStore, ACBrBase, ACBrEnterTab, cxContainer,
  cxGridTableView, cxGridCustomPopupMenu, cxGridPopupMenu, cxLookAndFeels,
  dxBarDBNav, ImgList, ActnList, dxBar, cxClasses, IBQuery, ExtCtrls,
  cxGridLevel, cxControls, cxGridCustomView, cxGridCustomTableView,
  cxGridDBTableView, cxGrid, cxPC, cxLabel, cxTextEdit, cxDBEdit,
  cxDropDownEdit, cxLookupEdit, cxDBLookupEdit, cxDBLookupComboBox,
  cxMaskEdit, cxButtonEdit, cxImage, cxGroupBox, cxGridBandedTableView,
  cxGridDBBandedTableView, cxLookAndFeelPainters, dxSkinsCore, dxSkinBlack,
  dxSkinBlue, dxSkinCaramel, dxSkinCoffee, dxSkinDarkRoom, dxSkinDarkSide,
  dxSkinFoggy, dxSkinGlassOceans, dxSkiniMaginary, dxSkinLilian,
  dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMoneyTwins,
  dxSkinOffice2007Black, dxSkinOffice2007Blue, dxSkinOffice2007Green,
  dxSkinOffice2007Pink, dxSkinOffice2007Silver, dxSkinOffice2010Black,
  dxSkinOffice2010Blue, dxSkinOffice2010Silver, dxSkinPumpkin, dxSkinSeven,
  dxSkinSharp, dxSkinSilver, dxSkinSpringTime, dxSkinStardust,
  dxSkinSummer2008, dxSkinsDefaultPainters, dxSkinValentine,
  dxSkinXmas2008Blue, dxSkinscxPCPainter, dxSkinsdxBarPainter, dxSkinsForm;

type
  TfrmCadProprietario = class(TfrmCadPadrao)
    dtListCODIGO: TIntegerField;
    dtListNOME: TIBStringField;
    dtListCPF_CNPJ: TIBStringField;
    dtListLOGRADOURO: TIBStringField;
    dtListNUMERO: TIBStringField;
    dtListCOMPLEMENTO: TIBStringField;
    dtListBAIRRO: TIBStringField;
    dtListCIDADE: TIBStringField;
    dtListUF: TIBStringField;
    dtEditCODIGO: TIntegerField;
    dtEditNOME: TIBStringField;
    dtEditCPF_CNPJ: TIBStringField;
    dtEditLOGRADOURO: TIBStringField;
    dtEditNUMERO: TIBStringField;
    dtEditCOMPLEMENTO: TIBStringField;
    dtEditBAIRRO: TIBStringField;
    dtEditCIDADE: TIBStringField;
    dtEditUF: TIBStringField;
    dtEditCEP: TIBStringField;
    dtEditCONTADOR: TIntegerField;
    edtCodigo: TcxDBTextEdit;
    cxLabel1: TcxLabel;
    cxDBTextEdit3: TcxDBTextEdit;
    cxLabel2: TcxLabel;
    edtNome: TcxDBTextEdit;
    cxLabel3: TcxLabel;
    cxDBTextEdit2: TcxDBTextEdit;
    cxLabel5: TcxLabel;
    cxDBTextEdit1: TcxDBTextEdit;
    cxLabel4: TcxLabel;
    cxDBTextEdit4: TcxDBTextEdit;
    cxLabel6: TcxLabel;
    cxDBTextEdit5: TcxDBTextEdit;
    cxLabel7: TcxLabel;
    cxDBTextEdit6: TcxDBTextEdit;
    cxLabel8: TcxLabel;
    cxDBTextEdit7: TcxDBTextEdit;
    cxLabel9: TcxLabel;
    cxDBTextEdit8: TcxDBTextEdit;
    cxLabel10: TcxLabel;
    btnContador: TcxButtonEdit;
    cbContador: TcxDBLookupComboBox;
    cxLabel11: TcxLabel;
    cxDBTextEdit9: TcxDBTextEdit;
    cxLabel12: TcxLabel;
    dtEditCRC: TIBStringField;
    dsContador: TDataSource;
    lstContador: TIBQuery;
    lstContadorCODIGO: TIntegerField;
    lstContadorNOME: TIBStringField;
    dtListCEP: TIBStringField;
    dtListCONTADOR: TIntegerField;
    dtListCRC: TIBStringField;
    dtListNOME_CONTADOR: TIBStringField;
    dtListEMAIL: TIBStringField;
    dtListFONE: TIBStringField;
    dtEditFONE: TIBStringField;
    dtEditEMAIL: TIBStringField;
    cxDBTextEdit10: TcxDBTextEdit;
    cxLabel13: TcxLabel;
    cxDBTextEdit11: TcxDBTextEdit;
    cxLabel14: TcxLabel;
    dtEditLOGOTIPO: TBlobField;
    cxGroupBox1: TcxGroupBox;
    img1: TcxDBImage;
    GridDBBandedTableView2CODIGO: TcxGridDBBandedColumn;
    GridDBBandedTableView2NOME: TcxGridDBBandedColumn;
    GridDBBandedTableView2CPF_CNPJ: TcxGridDBBandedColumn;
    GridDBBandedTableView2LOGRADOURO: TcxGridDBBandedColumn;
    GridDBBandedTableView2NUMERO: TcxGridDBBandedColumn;
    GridDBBandedTableView2COMPLEMENTO: TcxGridDBBandedColumn;
    GridDBBandedTableView2BAIRRO: TcxGridDBBandedColumn;
    GridDBBandedTableView2CIDADE: TcxGridDBBandedColumn;
    GridDBBandedTableView2UF: TcxGridDBBandedColumn;
    GridDBBandedTableView2CEP: TcxGridDBBandedColumn;
    GridDBBandedTableView2CONTADOR: TcxGridDBBandedColumn;
    GridDBBandedTableView2CRC: TcxGridDBBandedColumn;
    GridDBBandedTableView2NOME_CONTADOR: TcxGridDBBandedColumn;
    GridDBBandedTableView2EMAIL: TcxGridDBBandedColumn;
    GridDBBandedTableView2FONE: TcxGridDBBandedColumn;
    procedure FormShow(Sender: TObject);
    procedure btnContadorClick(Sender: TObject);
    procedure ActCadLookupExecute(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmCadProprietario: TfrmCadProprietario;

implementation

uses untCadTerceiros;

{$R *.dfm}

procedure TfrmCadProprietario.FormShow(Sender: TObject);
begin
  inherited;
  lstContador.Close;
  lstContador.Open;
end;

procedure TfrmCadProprietario.btnContadorClick(Sender: TObject);
begin
  inherited;
  frmCadTerceiros := TfrmCadTerceiros.Create(Self);
  frmCadTerceiros.ShowModal;

  lstContador.Close;
  lstContador.Open;

  dtEditCONTADOR.Value := frmCadTerceiros.Codigo;

  frmCadTerceiros.Free;
  frmCadTerceiros := nil;
end;

procedure TfrmCadProprietario.ActCadLookupExecute(Sender: TObject);
begin
  inherited;
  if cbContador.Focused then
    btnContador.OnClick(btnContador);
end;

end.
